package com.rado.tf.gui.event;

import com.rado.tf.gui.view.common.Presenter;

import java.util.Map;

/**
 * Created by parado on 07.03.14.
 */
public class AppEvent extends UIEvent
{
   private Object data;

   private Map<String, Object> dataMap;

   /**
    * Create a new ApplicationEvent.
    *
    * @param source    the component that published the event (never {@code null})
    * @param eventType
    */
   public <T extends Presenter> AppEvent(T source, UIEventTypes eventType)
   {
      super(source, eventType);
   }

   public <X> X getData()
   {
      return (X) data;
   }

   public <X> X getData(String key)
   {
      if (dataMap == null)
      {
         return null;
      }
      return (X) dataMap.get(key);
   }
}
